<template>
  <view class="custom-navbar" :style="{ paddingTop: statusBarHeight + 'px', backgroundColor: backgroundColor }">
    <view class="navbar-content">
      <text class="navbar-title" :style="{ color: titleColor }">{{ title }}</text>
    </view>
  </view>
</template>

<script>
export default {
  name: 'CustomNavbar',
  props: {
    title: {
      type: String,
      default: ''
    },
    backgroundColor: {
      type: String,
      default: '#F8F8F8'
    },
    titleColor: {
      type: String,
      default: '#000000'
    }
  },
  data() {
    return {
      statusBarHeight: 20
    }
  },
  created() {
    // Get the status bar height
    uni.getSystemInfo({
      success: (res) => {
        this.statusBarHeight = res.statusBarHeight
      }
    })
  }
}
</script>

<style>
.custom-navbar {
  position: fixed;
  width: 100%;
  top: 0;
  left: 0;
  z-index: 999;
}

.navbar-content {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.navbar-title {
  font-size: 16px;
  font-weight: 500;
}
</style> 